package model;

import java.util.ArrayList;
import java.util.Queue;

import commands.Command;

public class CommandQueue {
	
	private ArrayList<Command> queue;
	
	public CommandQueue(){
		queue = new ArrayList<Command>();
	}
	
	public synchronized void push(Command c){
		// check who the last command was for, if this one if for the
		// same player, than there may have been two commands generated. Execute
		// the one that made it in first. //TODO
		queue.add(c);
	}
	
	public synchronized Command pop(){
		Command c = null;
		if(queue.size() > 0){
			c = queue.remove(0);
		}
		return c;
	}

}
